<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
DRA Systems: OR-Objects 1.2.4: Class  TSPBase
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../drasys/or/graph/tsp/ThreeOpt.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../drasys/or/graph/tsp/TwoOpt.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="TSPBase.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
drasys.or.graph.tsp</FONT>
<BR>
Class  TSPBase</H2>
<PRE>
java.lang.Object
  |
  +--<B>drasys.or.graph.tsp.TSPBase</B>
</PRE>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../drasys/or/graph/tsp/BestOf.html">BestOf</A>, <A HREF="../../../../drasys/or/graph/tsp/ConstructBase.html">ConstructBase</A>, <A HREF="../../../../drasys/or/graph/tsp/Geni.html">Geni</A>, <A HREF="../../../../drasys/or/graph/tsp/ImproveBase.html">ImproveBase</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>TSPBase</B><DT>extends java.lang.Object</DL>

<P>
A base class containing features common to many TSP algorithms.
<P>
<HR>

<P>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->


<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#checkChangeCount()">checkChangeCount</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#countVertices()">countVertices</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#forwardCost(int, int)">forwardCost</A></B>(int&nbsp;r,
            int&nbsp;c)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retuns the forward cost between two vertices.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#getCost()">getCost</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the cost of the solution tour.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.util.Vector</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#getTour()">getTour</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the improved tour from the construction algorithm.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#initVertices(int, int)">initVertices</A></B>(int&nbsp;from,
             int&nbsp;to)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#initVertices(java.util.Vector)">initVertices</A></B>(java.util.Vector&nbsp;tour)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#reverseCost(int, int)">reverseCost</A></B>(int&nbsp;c,
            int&nbsp;r)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retuns the reverse cost between two vertices.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.util.Vector</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#rotateClosedTour(java.util.Vector, java.lang.Object)">rotateClosedTour</A></B>(java.util.Vector&nbsp;tour,
                 java.lang.Object&nbsp;key)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotates the closed tour until the vertex that matches key is the vertex that is repeated on both ends.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#setEdgeKey(java.lang.Object)">setEdgeKey</A></B>(java.lang.Object&nbsp;edgeKey)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the key used to select from parallel edges between vertices.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#setGraph(drasys.or.graph.GraphI)">setGraph</A></B>(<A HREF="../../../../drasys/or/graph/GraphI.html">GraphI</A>&nbsp;graph)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the graph.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../drasys/or/graph/tsp/TSPBase.html#setProperties(drasys.or.graph.PropertiesI)">setProperties</A></B>(<A HREF="../../../../drasys/or/graph/PropertiesI.html">PropertiesI</A>&nbsp;properties)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the edge properties object.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, 
equals, 
finalize, 
getClass, 
hashCode, 
notify, 
notifyAll, 
toString, 
wait, 
wait, 
wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="checkChangeCount()"><!-- --></A><H3>
checkChangeCount</H3>
<PRE>
protected void <B>checkChangeCount</B>()</PRE>
<DL>
</DL>
<HR>

<A NAME="setProperties(drasys.or.graph.PropertiesI)"><!-- --></A><H3>
setProperties</H3>
<PRE>
public void <B>setProperties</B>(<A HREF="../../../../drasys/or/graph/PropertiesI.html">PropertiesI</A>&nbsp;properties)</PRE>
<DL>
<DD>Sets the edge properties object.</DL>
<HR>

<A NAME="rotateClosedTour(java.util.Vector, java.lang.Object)"><!-- --></A><H3>
rotateClosedTour</H3>
<PRE>
public java.util.Vector <B>rotateClosedTour</B>(java.util.Vector&nbsp;tour,
                                         java.lang.Object&nbsp;key)
                                  throws <A HREF="../../../../drasys/or/graph/VertexNotFoundException.html">VertexNotFoundException</A></PRE>
<DL>
<DD>Rotates the closed tour until the vertex that matches key is the vertex that is repeated on both ends.</DL>
<HR>

<A NAME="setEdgeKey(java.lang.Object)"><!-- --></A><H3>
setEdgeKey</H3>
<PRE>
public void <B>setEdgeKey</B>(java.lang.Object&nbsp;edgeKey)</PRE>
<DL>
<DD>Sets the key used to select from parallel edges between vertices.
The default value for 'edgeKey' is null.</DL>
<HR>

<A NAME="setGraph(drasys.or.graph.GraphI)"><!-- --></A><H3>
setGraph</H3>
<PRE>
public void <B>setGraph</B>(<A HREF="../../../../drasys/or/graph/GraphI.html">GraphI</A>&nbsp;graph)</PRE>
<DL>
<DD>Sets the graph.</DL>
<HR>

<A NAME="initVertices(int, int)"><!-- --></A><H3>
initVertices</H3>
<PRE>
protected void <B>initVertices</B>(int&nbsp;from,
                            int&nbsp;to)</PRE>
<DL>
</DL>
<HR>

<A NAME="countVertices()"><!-- --></A><H3>
countVertices</H3>
<PRE>
protected int <B>countVertices</B>()</PRE>
<DL>
</DL>
<HR>

<A NAME="initVertices(java.util.Vector)"><!-- --></A><H3>
initVertices</H3>
<PRE>
protected void <B>initVertices</B>(java.util.Vector&nbsp;tour)</PRE>
<DL>
</DL>
<HR>

<A NAME="getCost()"><!-- --></A><H3>
getCost</H3>
<PRE>
public double <B>getCost</B>()</PRE>
<DL>
<DD>Returns the cost of the solution tour.<DD><DL>
<DT><B>Throws:</B><DD><A HREF="../../../../drasys/or/graph/GraphError.html">GraphError</A> - if no solution was created.</DL>
</DD>
</DL>
<HR>

<A NAME="getTour()"><!-- --></A><H3>
getTour</H3>
<PRE>
public java.util.Vector <B>getTour</B>()</PRE>
<DL>
<DD>Returns the improved tour from the construction algorithm.
The vector contains all the edges and the vertices in alternating order starting and ending with a vertex.
The elements will always be arranged in the order of forward tour traversal.<DD><DL>
<DT><B>Throws:</B><DD><A HREF="../../../../drasys/or/graph/GraphError.html">GraphError</A> - if no solution was created.</DL>
</DD>
</DL>
<HR>

<A NAME="forwardCost(int, int)"><!-- --></A><H3>
forwardCost</H3>
<PRE>
public final double <B>forwardCost</B>(int&nbsp;r,
                                int&nbsp;c)</PRE>
<DL>
<DD>Retuns the forward cost between two vertices.</DL>
<HR>

<A NAME="reverseCost(int, int)"><!-- --></A><H3>
reverseCost</H3>
<PRE>
public final double <B>reverseCost</B>(int&nbsp;c,
                                int&nbsp;r)</PRE>
<DL>
<DD>Retuns the reverse cost between two vertices.</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../drasys/or/graph/tsp/ThreeOpt.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../drasys/or/graph/tsp/TwoOpt.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="TSPBase.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
Copyright(C)1997-2000 by DRA Systems all rights reserved. <A HREF=http://OpsResearch.com TARGET=HOME>OpsResearch.com</A>
</BODY>
</HTML>
